package tddc77.yahtzee.swing;

/**
 *
 * @author John Törnblom (johto012), Mikael Silvén (miksi016)
 */
public class AboutDialog extends javax.swing.JDialog
{

    /** Creates new form AboutDialog */
    public AboutDialog(java.awt.Frame parent, boolean modal)
    {
        super(parent, modal);
        initComponents();

        mickeLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        johnLabel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        htmlInfoLabel = new javax.swing.JLabel();
        johnLabel = new javax.swing.JLabel();
        mickeLabel = new javax.swing.JLabel();
        okButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("About Yahtzee");
        setResizable(false);

        htmlInfoLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        htmlInfoLabel.setText("<html> This application was produced during the course TDDC77 at Linköping University, Sweden. For more information, vist the course website at <a href=\"http://www.ida.liu.se/~TDDC77\">http://www.ida.liu.se/~TDDC77</a>");
        htmlInfoLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        johnLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tddc77/yahtzee/swing/avatar_john.png"))); // NOI18N
        johnLabel.setToolTipText("John Törnblom");
        johnLabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                johnLabelMouseClicked(evt);
            }
        });

        mickeLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tddc77/yahtzee/swing/avatar_micke.png"))); // NOI18N
        mickeLabel.setToolTipText("Mikael Silvén");
        mickeLabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                mickeLabelMouseClicked(evt);
            }
        });

        okButton.setText("OK");
        okButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                okButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(mickeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(johnLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(okButton, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(htmlInfoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 246, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(htmlInfoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(okButton))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(johnLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(mickeLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void okButtonActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_okButtonActionPerformed
    {//GEN-HEADEREND:event_okButtonActionPerformed
        dispose();
    }//GEN-LAST:event_okButtonActionPerformed

    private void johnLabelMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_johnLabelMouseClicked
    {//GEN-HEADEREND:event_johnLabelMouseClicked
        if (java.awt.Desktop.isDesktopSupported())
        {
            java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
            if (desktop != null)
            {
                try
                {
                    desktop.mail(new java.net.URI("mailto",
                            "johto012@student.liu.se", null));
                }
                catch (Throwable t)
                {
                }
            }
        }
    }//GEN-LAST:event_johnLabelMouseClicked

    private void mickeLabelMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_mickeLabelMouseClicked
    {//GEN-HEADEREND:event_mickeLabelMouseClicked
        if (java.awt.Desktop.isDesktopSupported())
        {
            java.awt.Desktop desktop = java.awt.Desktop.getDesktop();
            if (desktop != null)
            {
                try
                {
                    desktop.mail(new java.net.URI("mailto",
                            "miksi016@student.liu.se", null));
                }
                catch (Throwable t)
                {
                }
            }
        }
    }//GEN-LAST:event_mickeLabelMouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel htmlInfoLabel;
    private javax.swing.JLabel johnLabel;
    private javax.swing.JLabel mickeLabel;
    private javax.swing.JButton okButton;
    // End of variables declaration//GEN-END:variables
}
